package org.person.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.person.springcloud.models.CommonResult;
import org.person.springcloud.models.Payment;
import org.person.springcloud.service.PaymentFeignService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @PostMapping("/consumer/payment")
    public CommonResult save(@RequestBody Payment payment) {
        return paymentFeignService.save(payment);
    }

    @GetMapping("/consumer/payment/{id}")
    public CommonResult get(@PathVariable("id") Long id) {
        return paymentFeignService.get(id);
    }

    @GetMapping("/consumer/payment/feign/timeout")
    public String paymentFeignTimeout() {
        return paymentFeignService.paymentFeignTimeout();
    }
}
